/**
 * KnowledgeOutlineService.java
 * Version 1.0.0
 * Created on 2018年7月16日
 *
 */
package com.yincheng.oes.business.base.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yincheng.oes.business.base.entity.KnowledgeOutline;
import com.yincheng.oes.business.base.entity.KnowledgeRoot;
import com.yincheng.oes.business.base.entity.Question;
import com.yincheng.oes.business.base.mapper.KnowledgeOutlineMapper;
import com.yincheng.oes.business.base.mapper.KnowledgeRootMapper;
import com.yincheng.oes.business.base.mapper.QuestionKnowledgeOutlineMapper;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2018年7月16日
 * 功能描述：大纲（知识点）服务类
 * 邮箱地址：446948434@qq.com
 */
@Service
public class KnowledgeOutlineService {

    @Autowired
    private KnowledgeOutlineMapper knowledgeOutlineMapper;

    @Autowired
    private QuestionKnowledgeOutlineMapper questionKnowledgeOutlineMapper;

    @Autowired
    private KnowledgeRootMapper knowledgeRootMapper;

    public List<KnowledgeRoot> getRootOutlines() {
        List<KnowledgeRoot> list = knowledgeRootMapper.selectAll();
        return list;
    }

    public List<KnowledgeOutline> getKnowledgeOutlinesByYearAndType(Integer yearNum, String outlineType) {
        List<KnowledgeOutline> list = knowledgeOutlineMapper.selectByYearAndType(yearNum, outlineType);
        return list;
    }

    /**
     * 根据父级id获取下一级所有子节点大纲信息
     *
     * @param parentId
     * @return
     */
    public List<KnowledgeOutline> getKnowledgeOutlinesByParentId(Integer parentId) {
        List<KnowledgeOutline> list = knowledgeOutlineMapper.selectByParentId(parentId);
        return list;
    }

    /**
     * 根据大纲id获取关联的题目信息列表
     *
     * @param outlineId
     * @return
     */
    public List<Question> getQuestionsByOutlineId(Integer outlineId) {
        List<Question> list = questionKnowledgeOutlineMapper.selectByOutlineId(outlineId);
        return list;
    }
}
